package com.ulook.lookplanet.data.source;

import android.util.Log;

import com.ulook.lookplanet.common.AppServer;
import com.ulook.lookplanet.data.model.TUser;
import com.ulook.lookplanet.util.ThrowException;
import com.ulook.lookplanet.util.net.AsynRequestUtil;
import com.ulook.lookplanet.util.net.RequestParams;
import com.ulook.lookplanet.util.net.ResponseCallback;

/**
 * 描述：
 *
 * @author L1998
 * @data 2021/3/26
 */
public class MainDataSource {

    /**
     * 发送网络请求验证登陆信息是否有效
     */
    public void verifyLoginInfo(int id, String pw, ResponseCallback callback){
        try {
            //LoggedInUser fakeUser = new LoggedInUser(java.util.UUID.randomUUID().toString(),"Jane Doe");
            RequestParams params = new RequestParams();
            params.put("id", String.valueOf(id));
            params.put("password", pw);
            Log.d("login- ", params.toString());
            AsynRequestUtil.post(AppServer.ROOT_PATH+"/login", params, TUser.class, callback);

        } catch (Exception e) {
            ThrowException.print(e,  "验证登陆信息请求失败");
        }
    }
}
